using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour
{
    public GameObject Enemy;
    public GameObject HealthPack;
    public int nb;
    public float spawnTime = 1;
    public float timeBetween = 0;
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < nb; i++)
        {
            Instantiate(Enemy, new Vector3(Random.Range(11, -11), Random.Range(6, 5), 0), Quaternion.identity);
        }
    }

    private void Update()
    {
        timeBetween += Time.deltaTime;
        if (timeBetween > spawnTime)
        {
            Instantiate(HealthPack, new Vector3(Random.Range(10, -10), Random.Range(6, 5), 0), Quaternion.identity);
            timeBetween = 0;
        }
    }
}
